<template>
  <div class="main">
    <el-table
      :data="tableData"
      style="width: 100%"
      :default-sort="{ prop: 'date', order: 'descending' }"
      :highlight-current-row = "true"
    >
    <el-table-column
      type="index"
      width="50">
    </el-table-column>
      <el-table-column prop="startTime" label="请求时间(时间戳)" sortable width="180">
      </el-table-column>
      <el-table-column prop="url" label="请求路径" :show-overflow-tooltip="true" sortable>
      </el-table-column>
      <el-table-column prop="method" label="请求方式" sortable width="150">
      </el-table-column>
      <el-table-column prop="serverPort" label="请求端口" sortable width="100">
      </el-table-column>
      <el-table-column prop="time" label="总耗时" sortable width="150">
      </el-table-column>
      <el-table-column prop="result" label="请求结果" sortable width="100">
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="150">
        <template slot-scope="scope">
          <el-button @click="check(scope.row)" type="text" size="small"
            >详情</el-button
          >
          <el-button @click="dialogVisible = true; removeId = scope.row._id" type="text" size="small"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background layout="sizes, prev, pager, next" :page-size="size" :page-sizes="[5, 7, 10, 15, 20, 50]" :current-page="page" :total="total" class="pagination" 
    @size-change="sizeChange" @current-change="currentChange"
    ></el-pagination>
    <!-- <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage2"
      :page-sizes="[5, 7, 10, 20, 50]"
      :page-size="100"
      :total="1000">
    </el-pagination> -->
    <el-dialog
      title="确认删除"
      :visible.sync="dialogVisible"
      width="30%">
      <span>确认删除该记录？</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="remove()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script src="./data.js"></script>
<style lang="scss" src="./data.scss" scoped></style>